package com.it.flowable.listener;

import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.delegate.ExecutionListener;

//   bpm中  <flowable:executionListener event="start" class="com.example.NextNodeListener"/>
// 通过类名直接反射
@Slf4j
public class MyExecutionListener implements ExecutionListener {

    @Override
    public void notify(DelegateExecution execution) {
        String currentActivityId = execution.getCurrentActivityId();
        String eventName = execution.getEventName(); // "start", "end", "take"
        log.warn("[ExecutionListener] 流程流转到节点: {}; 事件类型: {}, 流程实例ID: {}", currentActivityId, eventName, execution.getProcessInstanceId());
    }
}